--[[
    Convert an integer to its string representation.

    Required as an integer's __tostring method uses scientific notation for
    large numbers.  The use of math.floor is because Lua converts integer
    division to floating point numbers.  And math.abs is needed as -0 can be
    the result from modulo.
--]]
function int_to_str(n)
    if n < 10 then
        return math.abs(tostring(n))
    else
        return int_to_str(math.floor(n/10)) .. math.abs(tostring(n%10))
    end
end


function factorial(n)
    if n == 1 then
        return 1
    else
        return n * factorial(n-1)
    end
end


print(int_to_str(factorial(tonumber(arg[1]))))
